function Global() {
	this.locale = "zh_CN";
	this.port = "8080";
	this.suffix = "json";
	this.host = window.location.hostname;
	this.prefix = "http://"
	this.contextPath = "action";
	this.ajax = function(o) {
		$.ajax(buildOpts(o));
	};
	buildOpts = function(o) {
		var pots = {
			type : o.type == null ? "POST" : o.type,
			url : getUrl(o),
			data : toJSON(getData(o.data)),
			dataType : o.dataType == null ? "json" : o.dataType,
			async : o.async == null ? true : false,
			cache : o.cache == null ? true : false,
			beforeSend : o.beforeSend,
			error : function(result, status) {
				o.error(result, status);
			},
			success : function(result) {
				o.success(result);
			},
			complete : o.complete
		};
		return pots;
	};
	getUrl = function(o) {
		return this.prefix + this.host + ":" + this.port + "/" + this.contextPath + "/" + o.url + "."
				+ (o.suffix == null ? this.suffix : o.suffix);
	};
	getData = function(data) {
		var postData = {
			"locale" : this.locale == null ? "zh_CN" : this.locale,
			"data" : data
		};
		return postData;
	};
}
function toJSON(o) {
	var json = "";
	if (o == null) {
		json += 'null';
	} else if (typeof o == 'string') {
		json += '"' + o.replace('"', '') + '"';
	} else if (o.constructor == Date) {
		json += dateToString(o);
	} else if (typeof o == 'number') {
		json += o;
	} else if (typeof o == 'boolean') {
		json += o;
	} else if (typeof o == 'object') {
		if (o.constructor == Array) {
			json += '[';
			var len = o.length;
			for ( var i = 0; i < len; i++) {
				json += toJSON(o[i]);
				json += ',';
			}
			json = json.substring(0, json.length - 1);
			json += ']';
		} else {
			json += '{';
			for ( var k in o) {
				json += '"' + k + '":' + toJSON(o[k]);
				json += ',';
			}
			json = json.substring(0, json.length - 1);
			json += '}';
		}
	}
	return json;
}
function dateToString(o) {
	var json = "";
	if (o == null) {
		json += 'null';
	} else {
		json += o.getYear() + '-' + (o.getMonth() + 1) + '-' + o.getDate() + ' ' + o.getHours() + ':' + o.getMinutes()
				+ ':' + o.getSeconds();
	}
	return json;
}